﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class 学生基本信息 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conDBstr"]);
        con.Open();
        SqlCommand cmd = new SqlCommand("insert into Employee_Info value ('插入一条新数据')", con); 


        SqlCommand cmd = new SqlCommand("Select * from tb_user where name = '" + Request.Form["TextBox1"].ToString().Trim() + "' and password = '" + Request.Form["TextBox2"] + "'", con);
        SqlDataReader sdr = cmd.ExecuteReader();

        if (sdr.Read())
        {
            //判断验证码输入是否正确
            if (Request.Form["checkNum"].ToString().ToLower().Equals(Session["checkNum"].ToString().ToLower()))
            {
                Response.Write("<script language='javascript'>location.href='导航页.aspx'</script>");
            }
            else Response.Write("<script language='javascript'>alert(\"验证码错误\");</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('用户名或密码错误请重新登录');location.href='登陆.aspx'</script>");
        }

        con.Close();
    }
}
